<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title><?php echo $view_title?></title>
	<link rel=stylesheet href='./template/<?php echo $OJ_TEMPLATE?>/<?php echo isset($OJ_CSS)?$OJ_CSS:"hoj.css" ?>' type='text/css'>
</head>
<body>
<div>
	<?php require_once("contest-header.php");?>
<div id=main>



<center><h3>Contest<?php echo $view_cid?> - <?php echo $view_title ?></h3></center>

<div class="contest-info">
    开始于：<span class="label label-success"><?php echo $view_start_time?></span>
    结束于：<span class="label label-danger"><?php echo $view_end_time?></span>
    刷新时间：<span class="label label-warning"><?php echo date("Y-m-d H:i:s")?></span>
	<?php
				if ($now>$end_time) 
					echo "<span class='label label-info'>结束</span>";
				else if ($now<$start_time) 
					echo "<span class='label label-info'>未开始</span>";
				else 
					echo "<span class='label label-info'>比赛进行中</span>";
	?>
</div>

<div>
<ul class="nav nav-pills contest-nav" id="fn-nav">
    <li  class="active" ><a href="contest.php?cid=<?php echo $view_cid?>">题目</a></li>
    <li ><a href="contestrank.php?cid=<?php echo $view_cid?>">排名</a></li>
    <li ><a href="conteststatistics.php?cid=<?php echo $view_cid?>">统计</a></li>
    <li ><a href="status.php?cid=<?php echo $view_cid?>">状态</a></li>
</ul>
</div>

<div class="panel panel-primary">
        <div class="panel-heading">
          <h3 class="panel-title">比赛公告（请仔细阅读）</h3>
        </div>
        <div class="panel-body">
          <?php echo $view_description?>
        </div>
</div>

<hr>
<table class="table table-striped">
<thead>
    <tr>
        <th width=10%>题号</th>
        <th width=90%>题目标题</th>
    </tr>
</thead>
<tbody>

<?php 
			foreach($view_problemset as $row){
			    echo "<tr>";
				$tcnt=0;
				foreach($row as $table_cell){
				    $tcnt++;
					if($tcnt==1)continue;
					if($tcnt==4)break;
					
					echo "<td>";
					echo "\t".$table_cell;
					echo "</td>";
					
				}
				echo "</tr>";
			}
?>
</tbody>
</table>

<div id=foot>
	<?php require_once("oj-footer.php");?>

</div><!--end foot-->
</div><!--end main-->
</div><!--end wrapper-->
</body>
<script>
var diff=new Date("<?php echo date("Y/m/d H:i:s")?>").getTime()-new Date().getTime();
//alert(diff);
function clock()
    {
      var x,h,m,s,n,xingqi,y,mon,d;
      var x = new Date(new Date().getTime()+diff);
      y = x.getYear()+1900;
      if (y>3000) y-=1900;
      mon = x.getMonth()+1;
      d = x.getDate();
      xingqi = x.getDay();
      h=x.getHours();
      m=x.getMinutes();
      s=x.getSeconds();
  
      n=y+"-"+mon+"-"+d+" "+(h>=10?h:"0"+h)+":"+(m>=10?m:"0"+m)+":"+(s>=10?s:"0"+s);
      //alert(n);
      document.getElementById('nowdate').innerHTML=n;
      setTimeout("clock()",1000);
    } 
    clock();
</script>

</html>
